import React from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter, Switch } from 'react-router-dom'
import { Route, Redirect } from 'react-router-dom/cjs/react-router-dom.min'
import TabBar from './component/TabBar'
import Home from './component/Home'
import Category from './component/Category'
import Vedio from './component/Vedio'
import My from './component/My'
import './index.css'
var divDom = document.createElement('div')
divDom.setAttribute('id', 'wrap')

document.body.appendChild(divDom)

// 屏蔽微信打开时，下滑顶部出现域名
document.body.addEventListener(
  'touchmove',
  function (e) {
    e.preventDefault()
  },
  { passive: false }
)

ReactDOM.render(
  <BrowserRouter>
    {/* <Switch> */}
    <Route path="/" render={() => <Redirect to="/home" />} />
    <Route path="/home" component={TabBar(Home)}></Route>
    <Route path="/category" component={TabBar(Category)}></Route>
    <Route path="/vedio" component={TabBar(Vedio)}></Route>
    <Route path="/my" component={TabBar(My)}></Route>
    {/* </Switch> */}
  </BrowserRouter>,
  divDom
)
